package com.workspace.service;

import com.workspace.daomain.Photo;
import com.workspace.repository.PhotoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PhotoSevice {
    @Autowired
    private PhotoRepository photoRepository;

    //首页初步展示
    public List<Photo> findPhotos() {
        List<Photo> photoList = photoRepository.findPhotos();
        return photoList;
    }

    //分类查询
    public List<Photo> findAllPhotosByCid(Integer cid) {
        List<Photo> photoList = photoRepository.findPhotoByCategory(cid);
        return photoList;
    }
    //查询所有
    public List<Photo> findAllPhotos(){
        List<Photo> photoList=photoRepository.findAllPhotos();
        return photoList;
    }
    //删除图库数据
    public void deletePhoto(Integer id){
        photoRepository.deletePhotoById(id);
    }
}
